package com.example.qxfw.dzzh.controller;

import com.example.qxfw.common.SysResult;
import com.example.qxfw.common.entity.yj.AridWarnAnalysisFile;
import com.example.qxfw.dzzh.service.AridWarnAnalysisFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "地质灾害-短临预警")
@RestController
@CrossOrigin
@RequestMapping("/dlyj")
public class DlyjController {

    @Autowired
    private AridWarnAnalysisFileService aridWarnAnalysisFileService;

    @ApiOperation("获取地灾预警分析格点文件")
    @RequestMapping("/getAridWarnAnalysisFile")
    public SysResult getAridWarnAnalysisFile(String dateChar,String type,String fileName,String city){
        List<AridWarnAnalysisFile> aridWarnAnalysisFiles = aridWarnAnalysisFileService.listByParam(dateChar,type, fileName, city);
        return SysResult.success(aridWarnAnalysisFiles);
    }

    @ApiOperation("保存地灾预警分析格点文件")
    @RequestMapping("/saveAridWarnAnalysisFile")
    public SysResult saveAridWarnAnalysisFile(@RequestBody AridWarnAnalysisFile aridWarnAnalysisFile){
        AridWarnAnalysisFile save = aridWarnAnalysisFileService.save(aridWarnAnalysisFile);
        return SysResult.success(save);
    }
}
